#include<bits/stdc++.h>
using namespace std;
bool hws(int m){
	int a[10010] , b = m;
	int j = 0 , i = 1;
	while(b > 0){
		a[i] = b % 10;
		b = b / 10;
		j = j + 1;
		i = i + 1;
		continue;
	}
	for(int i = 1 ; i <= j ; i++){
		if(a[i] != a[j + 1 - i]){
			return false;
			break;
		}
	}
	return true;
}
int main(){
	freopen("hws.in" , "r" , stdin);
	freopen("hws.out" , "w" , stdout);
	int n , count = 0;
	cin >> n;
	for(int i = 1 ; i <= n ; i++){
		if(hws(i) == true){
			count = count + 1;
		}
	}
	cout << count << endl;
	return 0;
}